var log4js = require('log4js');
var path = require('path');
var fs = require('fs');
var conf = require('./conf');
var LOGGER_DIR = conf.LOG;

if (!fs.existsSync(LOGGER_DIR)) {
	fs.mkdirSync(LOGGER_DIR);
}

log4js.configure({ 
					appenders: [ 
					    		{
					    			category: 'spider',
					    		    type: 'dateFile',
					    		    filename: path.join(LOGGER_DIR, 'vvtrader-spider'),
					    		    pattern: '_yyyy-MM-dd_hh.log',
					    		    alwaysIncludePattern: true
					    		 }
					    	 ],
			    	 levels: {
			    	      '[all]': 'INFO'
			    	  }
			    });

module.exports = log4js.getLogger('spider');

